<?
require("config.php");

$label = "Category List";

$tb = "pro_category";

$Query = "select name,id from $tb WHERE level=0 order by id";
$r = myQuery($Query);

$Query = "select name, parent,id from $tb WHERE level=1 order by id";
$r1 = myQuery($Query);

$Query = "select name, parent,id from $tb WHERE level=2 order by id";
$r2 = myQuery($Query);

$sourceData = array();
$sourceLabel = array();

for ($i=0;$i<count($r);$i++){

	array_push($sourceData,$r[$i][1]);
	array_push($sourceLabel,$r[$i][0]);

	for ($n=0;$n<count($r1);$n++){

		if ($r[$i][1]==$r1[$n][1]){

			array_push($sourceData,$r1[$n][2]);
			array_push($sourceLabel,"&nbsp;&nbsp;-&nbsp;&nbsp;" . $r1[$n][0] );

			for ($m=0;$m<count($r2);$m++){

			if ($r1[$n][2]==$r2[$m][1]){

				array_push($sourceData,$r2[$m][2]);
				array_push($sourceLabel,"&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;" . $r2[$m][0] );

			}
			}

		}
	}

}

$html='';

for ($i=0;$i<count($sourceData);$i++) 
	$html.='<br><a href="product_list.php?cat='.urlencode($sourceData[$i]).'" target="mainFrame">'.$sourceLabel[$i].'</a>';

$close=1;

require($rela_path . "inc/header1.php");
?> <br>
<br>
<a href="product_list.php" target="mainFrame">[ All Products ]</a><br>

<?=$html?>
<br>
<?
require($rela_path . "inc/footer1.php");
?>
